package com.l.d.app.library.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

import skin.support.widget.SkinCompatTextView;

/**
 * Created by 林德 on 2017/4/5 16:19.
 * <p/>
 */
@Deprecated
public class FocusedTextView extends SkinCompatTextView implements View.OnFocusChangeListener {
    public FocusedTextView(Context context) {
        this(context, null);
    }

    public FocusedTextView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public FocusedTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.init();
    }

    private void init() {
        setOnFocusChangeListener(this);
    }

    @Override
    public boolean isFocused() {
        return true;
    }

    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (v == this && !hasFocus) {
            requestFocus();
        }
    }
}
